package store;

/**
 * User: Test
 * Date: 12.03.2008
 * Time: 23:44:22
 */
public class Column implements Cloneable
{
    private String columnName;
    private Class columnType;
    private Object defaultValue;
    private Table table;

    public Column(String columnName, Class columnType, Object defaultValue) {
        this.columnName = columnName;
        this.columnType = columnType;
        this.defaultValue = defaultValue;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public Class getColumnType() {
        return columnType;
    }

    public void setColumnType(Class columnType) {
        this.columnType = columnType;
    }

    public void setTable(Table table) {
        this.table = table;
    }

    public String toString() {
        return this.getColumnName() + " : " + this.getColumnType().getName();
    }

    public Table getTable() {
        return table;
    }

    public Object clone() throws CloneNotSupportedException {
        return (Column)super.clone();
    }

    public Object getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(Object defaultValue) {
        this.defaultValue = defaultValue;
    }
    /*public int compareTo(Object o) {
        if (o instanceof Column)
            if ((this.getColumnName().equalsIgnoreCase(((Column)o).getColumnName())) &&
                    (this.getColumnType().equals(((Column)o).getColumnType())) &&
                    (this.getTable() == ((Column)o).getTable()))
                return 0;
            else
                return -1;
        else
            return -1;
    }*/
}
